


#ifndef PF_EVENTHANDLER_H
#define PF_EVENTHANDLER_H

#include "pf_graphicview.h"
#include "lx_Export.h"

#define PF_MAXACTIONS 16

/**
 * The event handler owns and manages all actions that are currently 
 * active. All events going from the view to the actions come over
 * this class.
 */
class LX_EXPORT PF_EventHandler {
public:
    PF_EventHandler(PF_GraphicView* graphicView);
    ~PF_EventHandler();

    void back();
    void enter();

    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);
    void mouseMoveEvent(QMouseEvent *e);
    void mouseLeaveEvent();
    void mouseEnterEvent();

    void keyPressEvent(QKeyEvent* e);
    void keyReleaseEvent(QKeyEvent* e);

	void commandEvent(PF_CommandEvent* e);
	void enableCoordinateInput();
	void disableCoordinateInput();

    void setDefaultAction(PF_ActionInterface* action);
    PF_ActionInterface* getDefaultAction();
	
    void setCurrentAction(PF_ActionInterface* action);
    PF_ActionInterface* getCurrentAction();
	
    void killSelectActions();
    void killAllActions();
	
    bool hasAction();
    void cleanUp();
    void debugActions();
    void setSnapMode(LX_Define::SnapMode sm);
    void setSnapRestriction(LX_Define::SnapRestriction sr);

protected:
	PF_GraphicView* graphicView;
	PF_ActionInterface* defaultAction;
    PF_ActionInterface* currentActions[PF_MAXACTIONS];
    int actionIndex;
	bool coordinateInputEnabled;
};

#endif
